﻿#ifndef CAMERACTRL_H
#define CAMERACTRL_H
#include <QString>
#include<opencv.hpp>
#include <thread>
#include "MvCameraControl.h"
class CameraCtrl
{
public:
  CameraCtrl();
  CameraCtrl(unsigned int ip1,unsigned int ip2,unsigned int ip3,unsigned int ip4);
  bool printDeviceInfo(MV_CC_DEVICE_INFO* pstMVDevInfo);
  QString getIP();
  //static  unsigned int __stdcall WorkThread(void* pUser);
  void startAcquirsition();
  bool stopAcquisition();
  float getExposureTime(void);
  int setExposureTime(float time);
  float getGain(void);
  int setGain(float gain);
  void registerCaptureCallback(std::function<void(cv::Mat)> call_back);

  bool getIs_connect() const;

private:
  unsigned int acquireImgs(void* pUser);
  int nRet;
  void* handle = NULL;
  bool is_stop = true;
  bool is_connect = false;
  std::thread* acquisition_thread = nullptr;
  std::function<void(cv::Mat)> call_back_;
  QString ip  = "null";

};

#endif // CAMERACTRL_H
